﻿@model OASys.Web.Models.ModelTreePageModuleAssetNonAssetCommunityIndex
@{
    Layout = "~/Views/Shared/_LayoutEmbeddedFrame.cshtml";
}

<style type="text/css">
	#tree
	{
		float: left;
		height:100%;
		margin:1px 0 0 0;
		width: 160px;
	
	 background:#FBFBFB;
	 border:1px solid #DADADA;
		padding:10px 0 0 0;
	}
</style>
<script type="text/javascript">
    $(function () {
        $("#tree").height($("html").height());

        /* 初始化树
        ----------------------------------------------------------*/
        var tree = $("#tree").jstree({
            "types": {
                "valid_children": ["root"],
                "types": {
                    "root": {
                        "icon": {
                            "image": "/Content/images/all_project.jpg"
                        },

                        "hover_node": false,
                        "select_node": function () { }
                    },

                    "community": {
                        "icon": {
                            "image": "/Content/images/ico2.jpg"
                        },
                        "select_node": function () {

                        }
                    },
                    "buiding": {
                        "icon": {
                            "image": "/Content/images/ico3.jpg"
                        },
                        "select_node": function () {

                        }
                    }
                }
            },
            "plugins": ["themes", "html_data", "ui", "types"]
        });
        tree.bind("loaded.jstree", function (event, data) {
            tree.jstree("open_all");
        });
    });

    function setFrameUrl(url) {
        $("#embeddedFrame").attr("src", url);
    }

</script>
<div id="tree">
	<ul>
		<li rel="root">
			<a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/NonAssetCommunity/index')" >所有项目</a>
			<ul>
				@foreach (var item in Model.UTNonAssetCommunityCollection)
				{
					<li rel="community">
						<a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/NonAssetBuilding/index/?communityID=@item.ID')" title="@item.Name" >@Project.Common.StringUtility.CutString(item.Name,7)</a>
						<ul>
							@foreach (var buildingItem in Model.UTNonAssetBuildingCollection.Where(x=>x.CommunityID==item.ID))
	   {
							<li rel="buiding">
								<a href="javascript:void(0)" onclick="setFrameUrl('/ModuleAsset/NonAssetRoom/index/?buildingID=@buildingItem.ID')">
									@(string.IsNullOrEmpty(buildingItem.Name) ? buildingItem.No.Value.ToString() + "幢" : buildingItem.Name)
								</a>
							</li>
	   }
							
						</ul>
					</li>
					
				}
			</ul>
		</li>
	</ul>
</div>

